import request from '@/config/axios'

// AI 知识库 VO
export interface KnowledgeVO {
  id: number // 编号
  name: string // 知识库名称
  description: string // 知识库描述
  embeddingModelId: number // 向量模型
  embeddingModel: string // 向量模型
  topK: number // 检索topK
  similarityThreshold: number // 检索相似度阈值
  status: number // 状态
}


// AI 知识库 API
export const KnowledgeApi = {
  // 获取AI 知识库分页
  getKnowledgePage: async (params: PageParam) => {
    return await request.get({ url: `/ai/knowledge/page`, params })
  },

  // 获取AI 知识库简要信息列表
  getKnowledgeSimpleList: async (status?: number) => {
    return await request.get({ url: '/ai/knowledge/simple-list', params: { status } })
  },

  // 获取AI 知识库详情
  getKnowledge: async (id: number) => {
    return await request.get({ url: `/ai/knowledge/get`, params: { id } })
  },

  // 新增AI 知识库
  createKnowledge: async (data: KnowledgeVO) => {
    return await request.post({ url: `/ai/knowledge/create`, data })
  },

  // 修改AI 知识库
  updateKnowledge: async (data: KnowledgeVO) => {
    return await request.post({ url: `/ai/knowledge/update`, data })
  },

  // 删除AI 知识库
  deleteKnowledge: async (id: number) => {
    return await request.delete({ url: `/ai/knowledge/delete`, params: { id } })
  },

  // 导出AI 知识库 Excel
  exportKnowledge: async (params) => {
    return await request.download({ url: `/ai/knowledge/export-excel`, params })
  }
}
